<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>

    // 1.练习1：打印10次helloworld
    var count = 0
    while (count < 10) {
      console.log("Hello World:", count)
      count++
    }

    // 2.练习2：0 到 99 的数字
    var number = 0
    while (number < 100) {
      console.log(number++)
    }

    // 练习3 计算 0 到 99 的和
    var number = 0
    var sum = 0
    while (number < 100) {
      sum += number++
    }
    console.log(sum)

    // 练习3 计算 0 到 99 所有基数的和
    var number = 0
    var sum = 0
    while (number < 100) {
      if (number % 2 === 1) {
        sum += number
      }
      number++
    }
    console.log(sum)
  </script>
</body>

</html>